/*
 * @Author: 刘晓伟 1748805421@qq.com
 * @Date: 2024-04-09 09:30:35
 * @LastEditors: 郝奔 1425466221@qq.com
 * @LastEditTime: 2024-12-03 16:09:37
 * @Description: 
 * Copyright (c) 2024-present HBIS Digital Technology Co.,Ltd. All rights reserved. 
 */
import { default as request, cloud } from '@/framework/utils/request'
import { ResultData, ResultDataList } from '@/framework/api/common';
import { DictIdType, DictFormData, DictImportType } from "../types";
import { DictEnumManageListType, DictEnumIdType, DictEnumFormData, DictEnumIdsType, DictEnumbyCodeType, DictEnumImportType } from './types'
// 获取字典枚举项列表
export function dictEnumManagePage(params: Partial<DictEnumManageListType>): Promise<ResultDataList<DictEnumManageListType>> {
    return request({
        url: cloud.dqBasic + '/dictEnumManage/page',
        method: 'get',
        params
    })
}
// 获取字典枚举项列表不分页
export function dictEnumManageList(params: DictIdType): Promise<ResultData<DictEnumManageListType>> {
    return request({
        url: cloud.dqBasic + '/dictEnumManage/list',
        method: 'get',
        params
    })
}
// 修改字典枚举项状态
export function dictEnumManageEnable(data: Partial<DictEnumManageListType>): Promise<ResultData<null>> {
    return request({
        url: cloud.dqBasic + '/dictEnumManage/enable',
        method: 'post',
        data
    })
}
// 获取字典管理详情
export function dictEnumtManageDetail(params: DictEnumIdType): Promise<ResultData<DictEnumManageListType>> {
    return request({
        url: cloud.dqBasic + '/dictEnumManage/detail',
        method: 'get',
        params
    })
}
// 新增字典管理
export function dictEnumtManageAdd(data: DictEnumFormData): Promise<ResultData<null>> {
    return request({
        url: cloud.dqBasic + '/dictEnumManage/add',
        method: 'post',
        data
    })
}
// 修改字典管理
export function dictEnumtManageEdit(data: DictEnumFormData | DictEnumIdType): Promise<ResultData<null>> {
    return request({
        url: cloud.dqBasic + '/dictEnumManage/edit',
        method: 'post',
        data
    })
}
// 删除字典管理
export function dictEnumtManageDelete(data: DictEnumIdsType): Promise<ResultData<null>> {
    return request({
        url: cloud.dqBasic + '/dictEnumManage/delete',
        method: 'post',
        data
    })
}
//导出选中字典数据
export function dictEnumManageExport(data: DictEnumIdsType): Promise<ResultData<BlobPart>> {
    return request({
        url: cloud.dqBasic + '/dictEnumManage/export',
        method: 'post',
        data,
        responseType: 'arraybuffer'
    })
}
// 导出全部数据
export function dictEnumManageExportAll(data: DictEnumIdsType): Promise<ResultData<BlobPart>> {
    return request({
        url: cloud.dqBasic + '/dictEnumManage/exportAll',
        method: 'post',
        data,
        responseType: 'arraybuffer'
    })
}
// 导入下载模板
export function enumImportTemplate(params: DictIdType): Promise<ResultData<Blob>> {
    return request({
        url: cloud.dqBasic + '/dictEnumManage/import/template',
        method: 'get',
        params,
        responseType: 'arraybuffer'
    })
}
// 导入数据
export function dictEnumManageImport(data: DictEnumImportType): Promise<ResultData<DictImportType>> {
    return request({
        url: cloud.dqBasic + '/dictEnumManage/import/' + data.dictId,
        method: 'post',
        data: data.formData,
        headers: {
            'Content-Type': 'multipart/form-data'
        }
    })
}
// // 获取字典数据
export function getDictData(data: Partial<DictFormData>): Promise<ResultData<DictEnumManageListType[]>> {
    return request({
        url: cloud.itManage + '/dictEnumManage/getListByCode',
        method: 'post',
        data
    })
}
//系统配置使用接口
export function dictManageListByCode(params: DictEnumbyCodeType): Promise<ResultDataList<DictEnumManageListType>> {
    return request({
        url: cloud.dqBasic + '/dictEnumManage/listByCode',
        method: 'get',
        params
    })
}